<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:serv="gme://caGrid.caBIG/1.0/gov.nih.nci.cagrid.metadata.service" xmlns:com="gme://caGrid.caBIG/1.0/gov.nih.nci.cagrid.metadata.common" elementFormDefault="qualified" targetNamespace="gme://caGrid.caBIG/1.0/gov.nih.nci.cagrid.metadata.service" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import schemaLocation="../common/common.xsd" namespace="gme://caGrid.caBIG/1.0/gov.nih.nci.cagrid.metadata.common" />
  <xs:element name="Service" type="serv:Service" />
  <xs:complexType name="Service">
    <xs:annotation>
      <xs:documentation>A service is a "conceptual" definition of a collection of functional contexts.
This has no physical manifestation in the grid.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="pointOfContactCollection">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="com:PointOfContact" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="serviceContextCollection">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" ref="serv:ServiceContext" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" ref="serv:CaDSRRegistration" />
      <xs:element minOccurs="0" maxOccurs="unbounded" ref="com:SemanticMetadata" />
    </xs:sequence>
    <xs:attribute name="description" type="xs:string" use="required" />
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="version" type="xs:string" use="required" />
  </xs:complexType>
  <xs:element name="Operation" type="serv:Operation" />
  <xs:complexType name="Operation">
    <xs:annotation>
      <xs:documentation>This represents a method/operation/function in a service context.  Its input parameters are described by its InputParameter associations,  its output by its Output association, and any errors it produces by its Fault associations.

This is manifested as an operation of a service in the grid.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="inputParameterCollection">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="serv:InputParameter" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" ref="serv:Output" />
      <xs:element name="faultCollection">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="serv:Fault" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" maxOccurs="unbounded" ref="com:SemanticMetadata" />
    </xs:sequence>
    <xs:attribute name="description" type="xs:string" use="required" />
    <xs:attribute name="name" type="xs:string" use="required" />
  </xs:complexType>
  <xs:element name="Output" type="serv:Output" />
  <xs:complexType name="Output">
    <xs:annotation>
      <xs:documentation>Represents the result/output of an operation.  Its non-existence represents the operation produces no result.

This is manifested as the value of an operation response in the grid.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element minOccurs="0" ref="com:UMLClass" />
    </xs:sequence>
    <xs:attribute name="dimensionality" type="xs:int" use="required">
      <xs:annotation>
        <xs:documentation>Only valid if isArray is true; indicates number of dimensions in the array</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="isArray" type="xs:boolean" use="required" />
    <xs:attribute name="qName" type="xs:QName" use="required" />
  </xs:complexType>
  <xs:element name="InputParameter" type="serv:InputParameter" />
  <xs:complexType name="InputParameter">
    <xs:annotation>
      <xs:documentation>Represents an input parameter to an operation.

This is manifested as a parameter of a service request in the grid.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element minOccurs="0" ref="com:UMLClass" />
    </xs:sequence>
    <xs:attribute name="dimensionality" type="xs:int" use="required">
      <xs:annotation>
        <xs:documentation>Only valid if isArray is true; represents the dimensionality of the array</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="index" type="xs:int" use="required">
      <xs:annotation>
        <xs:documentation>This is the 0-based index of the parameter in the operation's signature</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="isArray" type="xs:boolean" use="required" />
    <xs:attribute name="isRequired" type="xs:boolean" use="required">
      <xs:annotation>
        <xs:documentation>Whether the given parameter is allowed to be null or not</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="qName" type="xs:QName" use="required" />
  </xs:complexType>
  <xs:element name="Fault" type="serv:Fault" />
  <xs:complexType name="Fault">
    <xs:annotation>
      <xs:documentation>This represents an error that could occur during the execution of the operation.

This is manifested as an operation fault in the grid.</xs:documentation>
    </xs:annotation>
    <xs:sequence />
    <xs:attribute name="description" type="xs:string" use="required" />
    <xs:attribute name="name" type="xs:string" use="required" />
  </xs:complexType>
  <xs:element name="ServiceContext" type="serv:ServiceContext" />
  <xs:complexType name="ServiceContext">
    <xs:annotation>
      <xs:documentation>This is a functional collection of operations that work over a common collection of stateful resources.
A service without stateful resources would have a single context.

This is manifested as an actual service in the grid.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="operationCollection">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="serv:Operation" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="contextPropertyCollection">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="serv:ContextProperty" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="description" type="xs:string" use="required" />
    <xs:attribute name="name" type="xs:string" use="required" />
  </xs:complexType>
  <xs:element name="ContextProperty" type="serv:ContextProperty" />
  <xs:complexType name="ContextProperty">
    <xs:annotation>
      <xs:documentation>This represents an exposed property of a service context's state.

This is manifested as a resource property in the grid.</xs:documentation>
    </xs:annotation>
    <xs:sequence />
    <xs:attribute name="description" type="xs:string" use="required" />
    <xs:attribute name="name" type="xs:string" use="required" />
  </xs:complexType>
  <xs:element name="CaDSRRegistration" type="serv:CaDSRRegistration" />
  <xs:complexType name="CaDSRRegistration">
    <xs:sequence />
    <xs:attribute name="registrationStatus" type="xs:string" use="required" />
    <xs:attribute name="workflowStatus" type="xs:string" use="required" />
  </xs:complexType>
</xs:schema>